<script>
$(document).ready(function() {
	<?php
    if($failed == 1) echo 'showNoti("Cấu hình: '.$name.'", "Cập nhập cấu hình thất bại!", "Err");';
	if($updated == 1) echo 'showNoti("Cấu hình: '.$name.'", "Cập nhập cấu hình thành công!", "Ok");';
	if($added == 1) echo 'showNoti("Cấu hình: '.$name.'", "Thêm cấu hình thành công!", "Ok");';
    ?>
});
</script>
<?php echo module_open(); ?>
<tr class="no-border">
    <td>
        <input type="hidden" class="tabId" value="<?php echo $GLOBALS['var']['mytab'] ?>" />
        <ul id="myTab" class="nav nav-tabs">
            <?php
            for($i = 0; $i < count($GLOBALS['config_groups']); $i++)
            {
                if ($GLOBALS['config_groups'][$i][1])
                {
                    echo '<li class="hide640'.($i == $GLOBALS['var']['mytab'] ? ' active' : '').'" onclick="set_mytab($(this))"><a href="#tabs-'.$i.'" data-toggle="tab">'.$GLOBALS['config_groups'][$i][0].'</a></li>';
                }
            }
            ?>
            <li class="dropdown active show640">
                <a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="current-tab-name"><?php echo $GLOBALS['config_groups'][$GLOBALS['var']['mytab']][0] ?></span> <span class="caret"></span></a>
                <ul class="dropdown-menu">
                <?php
                for($i = 0; $i < count($GLOBALS['config_groups']); $i++)
                {
            	    if ($GLOBALS['config_groups'][$i][1])
                    {
                        echo '<li'.($i == $GLOBALS['var']['mytab'] ? ' class="active"' : '').' onclick="set_mytab($(this))"><a href="#tabs-'.$i.'" data-toggle="tab">'.$GLOBALS['config_groups'][$i][0].'</a></li>';
                    }
            	}
                ?>
                </ul>
            </li>
        </ul>
        <div id="myTabContent" class="tab-content">
        <?php
        for ($i = 0; $i < count($GLOBALS['config_groups']); $i++)
        {
            if ($GLOBALS['config_groups'][$i][1])
            {
        ?>
            <div id="tabs-<?php echo $i ?>" class="tab-pane<?php echo ($i == $GLOBALS['var']['mytab'] ? ' active' : '') ?>">
                <table cellpadding="0" cellspacing="0" width="100%" border="0">
                    <tr>
                        <?php if($GLOBALS['per']['del']) echo '<td class="head center" width="1%"><input type="checkbox" class="checkAll" /></td>'; ?>
                        <td class="head center" width="2%">#</td>
                        <td class="head" width="20%">Tên cấu hình</td>
                        <?php if($GLOBALS['cfg']['develop_mode']) echo '<td class="head hide768" width="20%">PHP code</td>'; ?>
                        <td class="head hide768">Giá trị</td>
                        <td class="head" width="1%">&nbsp;</td>
                    </tr>
                    <?php
                    if(count($tab_config[$i]) && is_array($tab_config[$i]))
                    {
                        $n = 0;
                        foreach ($tab_config[$i] as $row)
                        {
                    ?>
                    <tr class="highlight<?php echo ($row['isnew'] ? ' table-flag-red' : '') ?>" id="<?php echo $row['id'] ?>" name="<?php echo $row['name_vn'] ?>">
                        <?php
                        if($GLOBALS['per']['del'])
                        {
                        ?>
                        <td class="fr center" width="1%"><?php echo sel_item($row['id']) ?></td>
                        <?php
                        }
                        ?>
                        <td class="fr center"><?php echo stt($row['id'], $n + 1) ?></td>
                        <td class="fr"><?php echo $row['name_vn'] ?></td>
                        <?php
                        if($GLOBALS['cfg']['develop_mode'])
                        {
                        ?>
                        <td class="fr hide768" nowrap="nowrap">$GLOBALS[<font color="brown">'cfg'</font>][<font color="brown">'<?php echo $row['keyword'] ?>'</font>]</td>
                        <?php
                        }
                        if($row['type'] == 2)
                        {
                        ?>
                        <td class="fr hide768"><?php echo toggle_input($row['id'], $row['value'], 'value', !$GLOBALS['per']['edit']) ?></td>
                        <?php
                        }
                        else
                        {
                        ?>
                        <td class="fr hide768"><?php echo nl2br(substr($row['value'], 0, 200)) ?></td>
                        <?php
                        }
                        ?>
                        <td class="fr" nowrap="nowrap">
                            <?php if($GLOBALS['per']['edit']) echo edit_alink('', $url_update.'/'.$row['id'].$uri_str) ?>
                            <?php if($GLOBALS['per']['del'] && $GLOBALS['cfg']['develop_mode']) echo del_restore_link($row['id'], $row['deleted']); ?>
                        </td>
                    </tr>
                    <?php
                            $n++;
                        }
                    }
                    else
                    {
                        echo no_data_mes(6);
                    }
                    ?>
                </table>
            </div>
        <?php
            }
        }?>
        </div>
    </td>
</tr>
<?php echo module_close(); ?>